home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gotya.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  8KB  |  252 lines

  1. /****************************************************************************
  2.  
  3.     Got-Ya driver by Zsolt Vasvari
  4.  
  5.  
  6. TODO: Emulated sound
  7.  
  8.       Hitachi HD38880BP
  9.                HD38882PA06
  10.  
  11.       I think HD38880 is a CPU/MCU, because the game just sends it a sound command (0-0x1a)
  12.  
  13. ****************************************************************************/
  14.  
  15. #include "driver.h"
  16. #include "vidhrdw/generic.h"
  17.  
  18.  
  19. extern unsigned char *gotya_scroll;
  20. extern unsigned char *gotya_foregroundram;
  21.  
  22. void gotya_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  23. int gotya_vh_start(void);
  24. void gotya_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  25. WRITE_HANDLER( gotya_video_control_w );
  26.  
  27. WRITE_HANDLER( gotya_soundlatch_w );
  28.  
  29.  
  30. static struct MemoryReadAddress readmem[] =
  31. {
  32.     { 0x0000, 0x3fff, MRA_ROM },
  33.     { 0x5000, 0x5fff, MRA_RAM },
  34.     { 0x6000, 0x6000, input_port_0_r },
  35.     { 0x6001, 0x6001, input_port_1_r },
  36.     { 0x6002, 0x6002, input_port_2_r },
  37.     { 0xc000, 0xd3ff, MRA_RAM },
  38.     { -1 }  /* end of table */
  39. };
  40.  
  41. static struct MemoryWriteAddress writemem[] =
  42. {
  43.     { 0x0000, 0x3fff, MWA_ROM },
  44.     { 0x5000, 0x5fff, MWA_RAM },
  45.     { 0x6004, 0x6004, gotya_video_control_w },
  46.     { 0x6005, 0x6005, gotya_soundlatch_w },
  47.     { 0x6006, 0x6006, MWA_RAM, &gotya_scroll },
  48.     { 0x6007, 0x6007, watchdog_reset_w },
  49.     { 0xc000, 0xc7ff, videoram_w, &videoram, &videoram_size },
  50.     { 0xc800, 0xcfff, colorram_w, &colorram },
  51.     { 0xd000, 0xd3df, MWA_RAM, &gotya_foregroundram },
  52.     { 0xd3e0, 0xd3ff, MWA_RAM, &spriteram },
  53.     { -1 }  /* end of table */
  54. };
  55.  
  56.  
  57. INPUT_PORTS_START( gotya )
  58.     PORT_START    /* IN0 */
  59.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
  60.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
  61.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
  62.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
  63.     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
  64.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Paper", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  65.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Scissors", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  66.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Rock", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  67.  
  68.     PORT_START    /* IN1 */
  69.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
  70.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  71.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
  72.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
  73.     PORT_DIPNAME( 0x10, 0x10, "Sound Test" )
  74.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  75.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  76.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Paper", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  77.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Scissors", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  78.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Rock", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  79.  
  80.     PORT_START    /* DSW1 */
  81.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  82.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  83.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  84.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  85.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  86.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  87.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Difficulty ) )
  88.     PORT_DIPSETTING(    0x00, "Easy" )
  89.     PORT_DIPSETTING(    0x10, "Hard" )
  90.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) )
  91.     PORT_DIPSETTING(    0x00, "None" )
  92.     PORT_DIPSETTING(    0x20, "15000" )
  93.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Lives ) )
  94.     PORT_DIPSETTING(    0x00, "3" )
  95.     PORT_DIPSETTING(    0x40, "5" )
  96.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  97.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  98.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  99.  
  100. INPUT_PORTS_END
  101.  
  102.  
  103. static struct GfxLayout charlayout =
  104. {
  105.     8,8,    /* 8*8 characters */
  106.     256,    /* 256 characters */
  107.     2,        /* 2 bits per pixel */
  108.     { 0, 4 },    /* the bitplanes are packed in one byte */
  109.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
  110.     { 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
  111.     16*8    /* every char takes 16 consecutive bytes */
  112. };
  113.  
  114. static struct GfxLayout spritelayout =
  115. {
  116.     16,16,    /* 16*16 characters */
  117.     64,        /* 64 characters */
  118.     2,        /* 2 bits per pixel */
  119.     { 0, 4 },    /* the bitplanes are packed in one byte */
  120.     { 0, 1, 2, 3, 24*8+0, 24*8+1, 24*8+2, 24*8+3,
  121.       16*8+0, 16*8+1, 16*8+2, 16*8+3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
  122.     { 39*8, 38*8, 37*8, 36*8, 35*8, 34*8, 33*8, 32*8,
  123.        7*8,  6*8,  5*8,  4*8,  3*8,  2*8,  1*8,  0*8 },
  124.     64*8    /* every char takes 64 consecutive bytes */
  125. };
  126.  
  127. static struct GfxDecodeInfo gfxdecodeinfo[] =
  128. {
  129.     { REGION_GFX1, 0, &charlayout,   0, 16 },
  130.     { REGION_GFX2, 0, &spritelayout, 0, 16 },
  131.     { -1 } /* end of array */
  132. };
  133.  
  134.  
  135. static const char *sample_names[] =
  136. {                                                // Address triggered at
  137.     "*gotya",
  138.     "01.wav",    /* game start tune */            // 075f
  139.     "02.wav",    /* coin in */                    // 0074
  140.     "03.wav",    /* eat dot */                    // 0e45
  141.     "05.wav",    /* eat dollar sign */            // 0e45
  142.  
  143.     "06.wav",    /* door open */                    // 19e1
  144.     "07.wav",    /* door close */                // 1965
  145.  
  146.     "08.wav",    /* theme song */                // 0821
  147.     //"09.wav"                                    // 1569
  148.  
  149.     /* one of these two is played after eating the last dot */
  150.     "0a.wav",    /* piccolo */                    // 17af
  151.     "0b.wav",    /* tune */                        // 17af
  152.  
  153.     //"0f.wav"                                    // 08ee
  154.     "10.wav",    /* 'We're even. Bye Bye!' */    // 162a
  155.     "11.wav",    /* 'You got me!' */                // 1657
  156.     "12.wav",    /* 'You have lost out' */        // 085e
  157.  
  158.     "13.wav",    /* 'Rock' */                    // 14de
  159.     "14.wav",    /* 'Scissors' */                // 14f3
  160.     "15.wav",    /* 'Paper' */                    // 1508
  161.  
  162.     /* one of these is played when going by the girl between levels */
  163.     "16.wav",    /* 'Very good!' */                // 194a
  164.     "17.wav",    /* 'Wonderful!' */                // 194a
  165.     "18.wav",    /* 'Come on!' */                // 194a
  166.     "19.wav",    /* 'I love you!' */                // 194a
  167.     "1a.wav",    /* 'See you again!' */            // 194a
  168.     0       /* end of array */
  169. };
  170.  
  171. static struct Samplesinterface samples_interface =
  172. {
  173.     4,    /* 4 channels */
  174.     50,    /* volume */
  175.     sample_names
  176. };
  177.  
  178.  
  179. static struct MachineDriver machine_driver_gotya =
  180. {
  181.     /* basic machine hardware */
  182.     {
  183.         {
  184.             CPU_Z80,
  185.             18432000/6,    /* 3.072 MHz ??? */
  186.             readmem,writemem,0,0,
  187.             interrupt,1
  188.         }
  189.     },
  190.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  191.     1,
  192.     0,
  193.  
  194.     /* video hardware */
  195.     36*8, 32*8, { 0, 36*8-1, 2*8, 30*8-1 },
  196.     gfxdecodeinfo,
  197.     8, 16*4,
  198.     gotya_vh_convert_color_prom,
  199.  
  200.     VIDEO_TYPE_RASTER,
  201.     0,
  202.     gotya_vh_start,
  203.     generic_vh_stop,
  204.     gotya_vh_screenrefresh,
  205.  
  206.     /* sound hardware */
  207.     0,0,0,0,
  208.     {
  209.         {
  210.             SOUND_SAMPLES,
  211.             &samples_interface
  212.         }
  213.     }
  214. };
  215.  
  216. /***************************************************************************
  217.  
  218.   Game driver(s)
  219.  
  220. ***************************************************************************/
  221.  
  222. ROM_START( gotya )
  223.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for main CPU */
  224.     ROM_LOAD( "gb-06.bin",    0x0000, 0x1000, 0x7793985a )
  225.     ROM_LOAD( "gb-05.bin",    0x1000, 0x1000, 0x683d188b )
  226.     ROM_LOAD( "gb-04.bin",    0x2000, 0x1000, 0x15b72f09 )
  227.     ROM_LOAD( "gb-03.bin",    0x3000, 0x1000, 0xf34d90ab )    /* this is the only ROM that passes the ROM test */
  228.  
  229.     ROM_REGION( 0x1000,  REGION_GFX1 | REGIONFLAG_DISPOSE )    /* characters */
  230.     ROM_LOAD( "gb-12.bin",    0x0000, 0x1000, 0x4993d735 )
  231.  
  232.     ROM_REGION( 0x1000,  REGION_GFX2 | REGIONFLAG_DISPOSE )    /* sprites */
  233.     ROM_LOAD( "gb-11.bin",    0x0000, 0x1000, 0x5d5eca1b )
  234.  
  235.     ROM_REGION( 0x0120,  REGION_PROMS )
  236.     ROM_LOAD( "prom.1a",    0x0000, 0x0020, 0x4864a5a0 )    /* color PROM */
  237.     ROM_LOAD( "prom.4c",    0x0020, 0x0100, 0x4745b5f6 )    /* lookup table */
  238.  
  239.     ROM_REGION( 0x1000,  REGION_USER1 )        /* no idea what these are */
  240.     ROM_LOAD( "gb-01.bin",    0x0000, 0x0800, 0xc31dba64 )
  241.     ROM_LOAD( "gb-02.bin",    0x0800, 0x0800, 0x65a7e284 )
  242.  
  243.     ROM_REGION( 0x4000,  REGION_USER2 )        /* HD38880 code? */
  244.     ROM_LOAD( "gb-10.bin",    0x0000, 0x1000, 0x8101915f )
  245.     ROM_LOAD( "gb-09.bin",    0x1000, 0x1000, 0x619bba76 )
  246.     ROM_LOAD( "gb-08.bin",    0x2000, 0x1000, 0x82f59528 )
  247.     ROM_LOAD( "gb-07.bin",    0x3000, 0x1000, 0x92a9f8bf )
  248. ROM_END
  249.  
  250.  
  251. GAME( 1981, gotya, 0, gotya, gotya, 0, ROT270, "Game-A-Tron", "Got-Ya (12/24/1981, prototype?)" )
  252.